/*
 * @Author: June
 * @Date: 2022-11-14 14:40:09
 * @LastEditors: 无处安放的六月
 * @LastEditTime: 2023-12-06 14:27:02
 * @Description:
 *
 */
import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/dobo-auth/token',
    method: 'post',
    data
  })
  // return new Promise((resolve, reject) => {
  //   resolve({
  //     data:{
  //       data:{
  //         accessToken:'123',
  //         adminType:2
  //       }
  //     }
  //   })
  // })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: { token }
  })
}

/**
 * @description: 左侧树查询菜单
 * @return {*}
 */
export function getMenu() {
  return request({
    // url: 'dobo-platform/menu/list2',
    url: `/platform/menu/listPlatform`,
    method: 'get'
  })
}

/**
 * 分配权限:根据用户查询菜单
 * @returns {*}
 */
export function getUserMenu(userId) {
  return request({
    // url: 'dobo-platform/menu/list2',
    url: `/platform/menu/listUser?userId=${userId}`,
    // url: `/platform/menu/listUser`,
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}
